package org.neowei.image.commond.Handle;

import java.io.File;

import org.neowei.image.api.ImageOption;
import org.neowei.image.commond.CmdOption;

public class WaterHandle extends AbstractHandle {

	@Override
	public void doHandle(ImageOption imageOption) throws Exception {
		CmdOption cmdOption = super.getCmdOption("composite");
		String hwstr = super.getStrHeightWidth(super.imageOption.getNeowidth(), super.imageOption.getNeoheight());
		if (!hwstr.equals("x"))
			cmdOption.AddRow("-resize", hwstr);
		cmdOption.AddRow("-geometry", "+0+0").AddRow("-gravity", super.imageOption.getWaterposition());
		cmdOption.setWaterWithFilename(new StringBuilder(super.imageOption.getWaterpath()).append(File.separatorChar).append(super.imageOption.getWaterfilename()).toString());
		super.crop(cmdOption);
	}

}
